package red.stu.demo.pconstraint;

import com.alibaba.fastjson.JSONObject;
import red.stu.pconstraint.ProcessUtils;
import red.stu.pconstraint.config.Configuration;
import red.stu.pconstraint.config.XMLConfigBuilder;
import red.stu.pconstraint.config.XMLMapperBuilder;
import red.stu.pconstraint.dto.mapper.ProcessMapper;

import java.io.BufferedReader;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;

/**
 * @author yihrmc @stu.red
 * @date 2019/11/14 16:54
 */
public class Main {

    public static void main(String[] args) throws IOException {
        XMLConfigBuilder xmlConfigBuilder = new XMLConfigBuilder(
                Files.newBufferedReader(Paths.get("E:\\work\\Pconstraint\\src\\test\\java\\pconstraint-config.xml")), false);

        Configuration configuration = xmlConfigBuilder.parse();

        System.out.println("configuration: " + configuration);

        BufferedReader bufferedReader = Files.newBufferedReader(Paths.get("E:\\work\\Pconstraint\\src\\test\\java\\WarrantyProcess.xml"));
        XMLMapperBuilder xmlMapperBuilder = new XMLMapperBuilder(bufferedReader, configuration, false);
        ProcessMapper processMapper = xmlMapperBuilder.parse();
        System.out.println("processMapper: " + JSONObject.toJSONString(processMapper) );

        testtt();

    }


    public static void testtt() {

    }

}
